<template>
	<view>
		<view style="position: relative;">
			<u-button class="exitLogin" @click="exitLogin" type="primary" plain shape="circle" text="退出登录"></u-button>
			<!-- http://img.gpsserver.cn:20080/wxhtml/img/logintype4/uUser.jpg -->
			<u--image :showLoading="true" :src="src" width="750rpx" height="200rpx" @click="click"></u--image>
		</view>
		<view class="list">
			<view class="item" v-for="(item, key) in list" :key="key" @click="itemtap(item)">
				<view class="label">
					{{ item.label }}
				</view>
				<view class="label" v-if="item.value">
					{{ item.value }}
				</view>
				<view v-else class="icon">
					<u-icon name="arrow-right" size="20" color="#969696"></u-icon>
				</view>
			</view>
		</view>
		<u-action-sheet :closeOnClickOverlay="true" @close="show = false" @select="selectClick" :actions="list1"
			:show="show"></u-action-sheet>
		<ztabbar></ztabbar>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				list1: [{
						name: 'English',
						color: this.$store.state.user.language === 'English' ? '#3b68f0' : '',
					},
					{
						name: '中文',
						color: this.$store.state.user.language === '中文' ? '#3b68f0' : '',
					}
				],
				show: false,
				src: "http://img.gpsserver.cn:20080/wxhtml/img/logintype4/uUser.jpg",
				list: [{
						icon: "iconleft_menu_charge",
						label: this.$z.$t("充电记录"),
						url: `/pages/GetRfCD/GetRfCD`,
					},
					{
						icon: "icongerenzhongxin-xuanzhongxin",
						label: this.$z.$t("用户管理"),
						url: `/pages/USearch/USearch`,
					},
					{
						icon: "icongerenzhongxin-xuanzhongxin",
						label: this.$z.$t("切换语言"),
						url: '',
					},

				],
			};
		},
		methods: {
			selectClick(item) {
				uni.setStorageSync('language', item.name)
				this.$store.commit('user/setLanguage', uni.getStorageSync('language'))
				if (uni.getStorageSync('utype') == 0) {
					uni.reLaunch({
						url: '/pages/index2/index2'
					});
				}
				if (uni.getStorageSync('utype') == 106 || uni.getStorageSync('utype') == 5 || uni.getStorageSync(
						'utype') == 6) {
					uni.reLaunch({
						url: '/pages/index1/index1'
					});
				}
			},
			itemtap(item) {
				if (item.url) {
					this.$z.gopage(item.url);
				} else {
					this.show = true
				}
			},
			exitLogin() {
				uni.reLaunch({
					url: '/pages/login/login'
				});
			}
		},
	};
</script>

<style lang="scss" scoped>
	.list {
		.item {
			height: 104rpx;
			display: flex;
			background-color: #fff;
			align-items: center;
			position: relative;

			.label {
				width: 260rpx;
				padding-left: 30rpx;
			}

			.icon {
				position: absolute;
				right: 30rpx;
			}

			&::after {
				content: "";
				height: 2rpx;
				position: absolute;
				left: 30rpx;
				bottom: 0;
				right: 0;
				background-color: #cfcfcf;
				transform: scaleY(0.5);
			}

			&.noafter {
				&::after {
					display: none;
				}
			}
		}
	}

	.exitLogin {
		width: fit-content;
		position: absolute;
		z-index: 99;
		right: 20rpx;
		top: 50%;
		transform: translateY(-50%);
	}
</style>